import { Component, OnInit } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {SERVER_URL} from '../../config';
import {LocalDataSource} from 'ng2-smart-table';
import {ReturnData} from '../../login/login.component';

@Component({
  selector: 'app-question',
  templateUrl: './question.component.html',
  styleUrls: ['./question.component.css']
})
export class QuestionComponent implements OnInit {
  settings = {
    noDataMessage: '暂无数据',
    actions: {
      add: false,
      edit: false,
      delete: false,
    },
    columns: {
      id: {
        title: 'ID',
        type: 'number',
        editable: false,
      },
      content: {
        title: '内容',
        type: 'string',
      },
      create_date: {
        title: '时间',
        type: 'string',
      },
    },
  };
  source: LocalDataSource = new LocalDataSource();

  constructor(private http: HttpClient) {
    this.http.get<ReturnData>(SERVER_URL + '?s=App.Feedback.Selectall').subscribe(data => {
      console.log(data);
      this.source.load(data.data.code);
    });
  }

  ngOnInit() {
  }

}
